package Demo;

public class Demo04_Runnable {
    public static void main(String[] args) {
        //实例化任务对象
        MyRunnable02 myRunnable02 = new MyRunnable02();
        MyRunnable03 myRunnable03 = new MyRunnable03();

        //创建线程对象
        Thread thread01 = new Thread(myRunnable02); //皮鞋1
        Thread thread02 = new Thread(myRunnable02); //皮鞋2
        Thread thread03 = new Thread(myRunnable03); //皮包01

        //启动线程，开始生产
        thread01.start();
        thread02.start();
        thread03.start();
    }
}


class MyRunnable02 implements Runnable{
    public void run(){
        while (true){
            try {
                Thread.sleep(1000);
            }catch (InterruptedException e){
                e.printStackTrace();
            }
            System.out.println("生产皮鞋，金币+20...");
        }
    }
}


class MyRunnable03 implements Runnable{
    public void run(){
        while (true){
            try {
                Thread.sleep(1000);
            }catch (InterruptedException e){
                e.printStackTrace();
            }
            System.out.println("生产皮鞋，金币+10...");
        }
    }
}